import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/admin/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/admin/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/admin/logout',
    method: 'post'
  })
}

export function edit(data) {
  return request({
    url: '/admin/edit',
    method: 'post',
    data
  })
}

export function delAdmin(id) {
  return request({
    url: '/admin/delAdmin',
    method: 'get',
    params: id
  })
}

export function findAdminById(id) {
  return request({
    url: '/admin/findAdminById',
    method: 'get',
    params: id
  })
}

export function findUserList(data) {
  return request({
    url: '/user/findUserList',
    method: 'get',
    params: { username: data.username, phone: data.phone, pageIndex: data.pageIndex }
  })
}

export function fileUpload(data) {
  return request({
    url: '/admin/avator',
    method: 'post',
    data
  })
}

